import {ref} from 'vue'
import {getLocalStorage, setLocalStorage} from "@/lib/util";
import usePcUpdateStore from "module-base/views/update/store/update";

export function useUpdateHandle(createAnimation, createParticle) {
    let {setShowUpdate,getVersion} = usePcUpdateStore()

    async function pauseUpdate() {
        setShowUpdate(false)
        myApi.handleCheckPcUpdate().then(res=>{
            setLocalStorage('ignoreVersion', res.version)
        })

    }

    function startUpdate() {
        createParticle(200)
        setTimeout(() => {
            createAnimation()
            myApi.handlePcToUpdate()
        }, 100)

    }

    return {
        pauseUpdate,
        startUpdate
    }
}
